<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
$.validator.addMethod("stringCheck", function(value, element) { 
	   return this.optional(element) || /^[\u0391-\uFFE5\w]+$/.test(value);       
	}, "只能包括中文字、英文字母、数字和下划线");  

	$(document).ready(function() {
		initProvince('province', 'city');
		// 表单验证使用属性validate进行验证
		$.metadata.setType("attr", "validate");
		$("#registerPhone").validate(
				{
					errorClass:"register_error",
					success : function(label) {
						label.addClass("register_success").text("");
					},
					rules : {
						nickname : {
							required : true,
							maxlength : 16,
							minlength : 4,
							remote : 'checkNickname.htm',
							stringCheck:true
						},
						password : {
							required : true,
							minlength : 6,
							maxlength : 20
						},
						checkPwd:{
							required : true,
							equalTo:'#password'
						}
						
					},
					messages : {
						nickname : {
							required : "请填写你的用户名",
							minlength : "用户名必须为4～16个字符",
							maxlength : "用户名必须为4～16个字符",
							remote : "该用户名已被注册",
							stringCheck: "用户名只能包括中文字、英文字母、数字和下划线"
						},
						password : {
							required : "请填写密码",
							minlength : "密码长度为6～20位",
							maxlength : "密码长度为6～20位"
						},
						checkPwd:{
							required : "请填写确认密码",
							equalTo: "两次密码输入不符"
						}
					},
					submitHandler : function() {
						alert("222222");
						if(provinceCode==0 || cityCode==0){
							alert("请填写地址");
							return;
						}
						
						$.post("register.htm", {
								jsonData : escape($.toJSON(family)),
								outAccountId : $("#outAccountId").val(),
								outAccountType : $("#outAccountType").val(),
								outAccountName : $("#outAccountName").val(),
								accessToken:$("#accessToken").val(),
								accessSecret:$("#accessSecret").val()
							}, function(data) {
								if (data == 'success') {
									$("#btnRegister").attr("disabled",true);
									window.location = "registerResult.htm";
								} 
							});

						
						
					}
				});
	});
	
	function  registerByEmail(){
		window.location.href="register.htm";
	}
</script>
</head>
<body>
    <!-- phone register-->
    	
        	<div class="head"></div>
            <div class="reg_content reg_phone">
            	<div class="title">
                	<span class="fr">已经有爽客网账号？<a href="#" class="clrgre">直接登录</a></span>
                </div>
                <div class="pd_20">
                	<div class="tip"><img src="../../images/smallpic/zc-bz.jpg" /></div>
                    <form id="registerPhone"  method="post">
                        <ul class="r_reg_info">
                            <li>
                                <label><i class="alarm">*</i>您的手机号：</label>
                                <input type="text" />
                                <a href="javascript:void(0);" class="else_reg" onclick="registerByEmail();">使用Email地址注册>></a>
                                <span class="info_tip">请填写您的真实手机号码，做为爽客网的登录账号</span>
                            </li>
                            <li>
                                <label><i class="alarm">*</i>用户名：</label>
                                <input type="text" name="nickname" id="nickname"/>
                                <span class="info_tip">4-16个字符，中英文均可，推荐使用中文名</span>
                            </li>
                            <li>
                                <label><i class="alarm">*</i>设置密码：</label>
                                <input type="password" id="password" name="password"/>
                                <span class="info_tip" >6-16个字符，推荐使用英文字母加数字的组合密码</span>
                            </li>
                            <li>
                                <label><i class="alarm">*</i>确认密码：</label>
                                <input type="password" id="checkPwd" name="checkPwd"/>
                                <span class="info_tip">请再次输入密码</span>
                            </li>
                            <li>
                                <label>会员卡号：</label>
                                <input type="text" />
                            </li>
                            <li>
                            	<label>所在地：</label>
                                <select id="province" name="province" style="width: 65px">
                                	<option selected="selected" >请选择</option>
		      					 </select>
                                 <select id="city" name="city" style="width: 65px">
                                 	<option selected="selected">请选择</option>
                                 </select>
                                <div class="other_info">
                                	<input type="checkbox" checked="checked" class="cb_accept" /><span>我已阅读并接受《<a href="#" class="clrblue">爽客网旅游网会员服务条款</a>》</span>
                                    
                                </div>
                            </li>
                        </ul>
                        <input type="image" class="reg_btn" id="reg_btn" />
                    </form>
                </div>
            </div>
            <div class="foot"></div>
        
        <!-- phone register--end-->
</body>
</html>